package eai.tp2.lpco.cameracatalog;




import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import eai.tp2.lpco.database.DigitalCamera;


@Stateless
public class CameraCatalogBean implements ICameraCatalog 
{
	@PersistenceContext(unitName="myLpcoCatalogue")	
	EntityManager em;

	//----------------------------------------------------
	
	public CameraCatalogBean() 
	{
		System.out.println("Load!!");
    }

	@Override
	public boolean addDigitalCamera(DigitalCamera camera) {

		System.out.println(camera.toString());
		em.persist(camera);
		em.flush();
		return true;
	}



	@Override
	public boolean removeDigitalCamera(DigitalCamera camera) {
		
		em.remove(camera);
		
		return false;
	}

	@Override
	public boolean updateDigitalCamera(DigitalCamera camera) {
		
		//is it necessary?
		return false;
	}
}
